package org.mybatis3.demo1;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.mybatis3.demo1.dao.UserMapper;
import org.mybatis3.demo1.pojo.User;
import org.mybatis3.util.MyBatisUtil;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Test7 {
    public static void main(String[] args) {
         SqlSession sqlSession=  MyBatisUtil.getSqlSession();

            List<User> userList=sqlSession.getMapper(UserMapper.class).getUserAndRoleName();
        for (int i=0;i<userList.size();i++){

            System.out.println("用户名："+userList.get(i).getUserCode()+"；角色名："+userList.get(i).getRoleName()+"；地址："+userList.get(i).getAddress());

        }
        MyBatisUtil.closeSqlSession();




    }
}
